home *** CD-ROM | disk | FTP | other *** search
- VERSION 5.00
- Begin VB.Form frmDBMan
- Caption = "Example 12-2-2"
- ClientHeight = 1440
- ClientLeft = 1116
- ClientTop = 1512
- ClientWidth = 4284
- LinkTopic = "Form1"
- PaletteMode = 1 'UseZOrder
- ScaleHeight = 1440
- ScaleWidth = 4284
- Begin VB.ListBox lstCities
- Height = 624
- Left = 2880
- TabIndex = 3
- Top = 120
- Width = 1215
- End
- Begin VB.CommandButton cmdFind
- Caption = "Find Cities"
- Height = 495
- Left = 120
- TabIndex = 2
- Top = 480
- Width = 2535
- End
- Begin VB.TextBox txtCountry
- Height = 285
- Left = 840
- TabIndex = 0
- Top = 120
- Width = 1815
- End
- Begin VB.Data datCities
- Caption = "Large World Cities"
- Connect = "Access"
- DatabaseName = "MEGACTY2.MDB"
- DefaultCursorType= 0 'DefaultCursor
- DefaultType = 2 'UseODBC
- Exclusive = 0 'False
- Height = 300
- Left = 120
- Options = 0
- ReadOnly = 0 'False
- RecordsetType = 1 'Dynaset
- RecordSource = "SELECT * FROM Cities ORDER BY city ASC"
- Top = 1080
- Width = 2655
- End
- Begin VB.Label lblCountry
- Caption = "Country"
- Height = 255
- Left = 120
- TabIndex = 1
- Top = 120
- Width = 615
- End
- Attribute VB_Name = "frmDBMan"
- Attribute VB_GlobalNameSpace = False
- Attribute VB_Creatable = False
- Attribute VB_PredeclaredId = True
- Attribute VB_Exposed = False
- Private Sub cmdFind_Click()
- Dim nom As String, criteria As String
- lstCities.Clear
- If txtCountry.Text <> "" Then
- nom = txtCountry.Text
- criteria = "country = " & "'" & nom & "'"
- datCities.Recordset.FindFirst criteria
- Do While datCities.Recordset.NoMatch = False
- lstCities.AddItem datCities.Recordset.Fields("city").Value
- datCities.Recordset.FindNext criteria
- Loop
- If lstCities.ListCount = 0 Then lstCities.AddItem "None"
- Else
- MsgBox "You must enter a country.", , ""
- txtCountry.SetFocus
- End If
- End Sub
- Private Sub Form_Load()
- 'Look for the data base in the same folder as the program
- datCities.DatabaseName = App.Path & "\MEGACTY2.MDB"
- End Sub
-